<template>
    <div>
        <div class="search flex-row">
            <van-icon name="arrow-left" class="search-icon" @click="$router.go(-1)"/>
            <van-search
                class="flex-1 search-input"
                v-model="value"
                placeholder="请输入搜索关键词"
                @search="onSearch"
            ></van-search>
        </div>
    </div>
</template>

<script>
export default {
    name: "GoodsSearch",
    data() {
        return {
            value: ""
        };
    },
    methods: {
        onSearch() {
            if (this.value == "") return this.fail("请输入搜索内容");
            this.$router.push({
                name: "goods-list",
                query: { key: this.value }
            });
        }
    }
};
</script>

<style scoped lang="scss">
</style>